﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SPSAndong.Model
{
    /// <summary>
    /// Ups对象模型
    /// </summary>
    public class UpsModel
    {
        /// <summary>
        /// 查询状态
        /// </summary>
        public bool QueryResult { get; set; } = true;
        /// <summary>
        /// 异常消息
        /// </summary>
        public string ErrorMsg { get; set; }
        /// <summary>
        /// 输入电压
        /// </summary>
        public decimal InputVoltage { get; set; }
        /// <summary>
        /// 上次转电池输入电压
        /// </summary>
        public decimal LastInputVoltage { get; set; }
        /// <summary>
        /// 输出电压
        /// </summary>
        public decimal OutputVoltage { get; set; }
        /// <summary>
        /// 负载
        /// </summary>
        public int Load { get; set; }
        /// <summary>
        /// 输入频率
        /// </summary>
        public decimal InputFrequency { get; set; }
        /// <summary>
        /// 每节电池=每个电池单元电池电压*6
        /// </summary>
        public decimal BatterycellVoltage { get; set; }
        /// <summary>
        /// 温度
        /// </summary>
        public decimal Temperature { get; set; }
        /// <summary>
        /// Ups状态
        /// </summary>

        public UpsState State { get; set; }
    }
    /// <summary>
    /// Ups状态
    /// </summary>
    public class UpsState
    {
        /// <summary>
        /// 1 : 市电异常
        /// </summary>
        public short CityElectricity { get; set; } = 0;
        /// <summary>
        /// 市电异常显示
        /// </summary>
        public string CityElectricityText
        {
            get
            {
                if (this.CityElectricity == 0)
                    return "市电正常";
                else
                    return "市电异常";
            }
        }
        /// <summary>
        ///  1 : 电池电压低
        /// </summary>
        public short BatteryVoltage { get; set; } = 0;
        /// <summary>
        /// 电池电压显示
        /// </summary>
        public string BatteryVoltageText
        {
            get
            {
                if (this.BatteryVoltage == 0)
                    return "电池电压正常";
                else
                    return "电池电压低";
            }
        }
        /// <summary>
        /// 1 : 旁路输出
        /// </summary>
        public short BypassOutput { get; set; }
        /// <summary>
        /// 旁路输出显示
        /// </summary>
        public short BypassOutputText { get; set; }
        /// <summary>
        /// 1 : UPS故障
        /// </summary>

        public short UpsFault { get; set; }
        /// <summary>
        /// UPS故障显示
        /// </summary>
        public string UpsFaultText
        {
            get
            {
                if (this.UpsFault == 0)
                    return "UPS正常";
                else
                    return "UPS故障";
            }
        }
        /// <summary>
        /// 1 : UPS 后备式 (0 ：在线式)
        /// </summary>

        public short UpsBackup { get; set; }
        /// <summary>
        /// 1 : UPS 后备式 (0 ：在线式)显示
        /// </summary>
        public string UpsBackupText
        {
            get
            {
                if (this.UpsBackup == 0)
                    return "UPS在线式";
                else
                    return "UPS后备式";
            }
        }
        /// <summary>
        /// <summary>
        /// 1 : 测试进行中
        /// </summary>

        public short Testing { get; set; }
        /// <summary>
        /// 测试进行中显示
        /// </summary>
        public string TestingText
        {
            get
            {
                if (this.Testing == 0)
                    return "正常运营";
                else
                    return "测试进行中";
            }
        }
        /// <summary>
        /// 内部保留:1
        /// </summary>

        public short OTher { get; set; }
        /// <summary>
        /// 保留：0
        /// </summary>

        public short OTher1 { get; set; }
    }
}
